<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>老师的互动列表</title>
		<link rel="stylesheet" type="text/css" href="../css/api.css"/>
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="../../css/base.css">
		<link rel="stylesheet" href="../../css/weui.min.css">
		<style>
			body {
			}
			.mui-table-view-cell > a:not(.mui-btn) {
				padding: 10px;
			}
			.cell-title {
				height: 22px;
			}
			.cell-subtitle, .message_content {
				height: 20px;
			}
			.right-div {
				width: 70px;
				float: right;
			}
			.left-div {
				margin-right: 70px;
			}
			.message_title {
				width: 90%;
			}
			.right-tag {
				text-align: right;
			}
			.mui-table-view .mui-media-object {
				margin-top: 10px;
			}
			.discuss-del {
				width: 18px;
				margin-right: 0px;
			}
			.discuss-del-div {
				text-align: right;
				height: 40px;
			}
		</style>
		<body>
			<div id="mian">
				<ul id="questionsList" class="mui-table-view">
					<li class="mui-table-view-cell mui-media">
						<a href="javascript:;"> <img class="mui-media-object mui-pull-left" src="../../image/icon_taolun1.png" >
						<div class="mui-media-body">
							<div class="right-div">
								<div class="discuss-del-div">
									<img src="../../image/icon_delete_green.png" class="discuss-del">
								</div>
								<p class="mui-ellipsis base_grey content_p right-tag">
									未参与
								</p>
							</div>
							<div class="left-div">
								<p class="mui-ellipsis base_dark_grey font16 cell-title">
									<span class="message_title"> 讨论名称 </span>
								</p>
								<p class="mui-ellipsis base_grey font14 content_p cell-subtitle">
									物流仓储一班
								</p>
								<p class="mui-ellipsis base_grey font14 content_p cell-subtitle">
									<span class="file_submit_time"> 2017-01-02 14:20 </span>
								</p>
							</div>
						</div> </a>
					</li>
				</ul>
			</div>
			<div class="noSign" hidden="hidden" id="noData">
				<img src="../../image/icon_img.png" width="60%">
				<p class="font16 top_15 base_dark_grey" >
					暂无数据
				</p>
			</div>
			<div class="loadFailure" hidden="hidden" id="noNet">
				<img src="../../image/icon_img01.png" width="60%">
				<p class="" >
					数据加载失败
				</p>
				<p>
					请检查您的网络
				</p>
				<button type="button"  onclick="loadData()"class="mui-btn mui-btn-outlined">
					重新加载
				</button>
			</div>
		</body>
		<script type="text/javascript" src="../../script/api.js"></script>
		<script type="text/javascript" src="../../script/MD5.js"></script>
		<script src="../../script/jquery.min.js" type="text/javascript"></script>
		<script type="text/javascript" src="../../script/requestTool.js"></script>
		<script src="../../script/common.js"></script>
		<script type="text/javascript">
				var page = 1;
			var row = 10;
			var refreshCount = 0;
			var  tid='';
			apiready = function(){
			    showProgress();
				loadNewData();
				setRefreshHeader();
				setPullUpRefresh();
				api.addEventListener({
			        name:'refreshQusetionData'
		        },function(ret,err){
		        	//coding...
		        	loadNewData();
		        });
			};
			function loadNewData() {
				page = 1;
				loadData();
			}

			function loadMoreData() {
				page++;
				loadData();
			}

			//获取班级学生列表
			function loadData() {
				showProgress();
				pageParam = api.pageParam;
				var params = {
					jid : $api.getStorage('cfnetppjxid'),
					//uid:"11924",
					uid : $api.getStorage('cfnetppuid'),
					page : page,
					rows : row
				};
				cfnetppPOST(url_getClassWorkList, params, true, function(data, status) {
					//				alert(JSON.stringify(params));
					api.hideProgress();
					api.refreshHeaderLoadDone();
					if (status == 'success') {
						if (data.code == 200) {
							var datas = data.data.list;
							refreshCount = data.data.total;
							if (students != '' && students.constructor == Array && students.length > 0) {
								$('#noData').hide();
								$('#noNet').hide();
								$('#mian').show();
								writelist(datas, datas.length);
							} else {
								$('#noData').show();
								$('#noNet').hide();
							}
						} else if (data.code = 109) {
							if (page == 1) {
								$('#noData').show();
								$('#noNet').hide();
								$('#mian').hide();
							}
						} else {
							if (page == 1) {
								$('#noData').show();
								$('#noNet').hide();
								$('#mian').hide();
							}
						}
					} else {
						$('#noData').hide();
						$('#noNet').show();
						$('#mian').hide();
					}
				});
			}

		function writelist(listdata,len){
		   var htmlsdata='';
		   for(var i=0;i<len;i++){
		     var data = listdata[i];
		     var type =data.type;
		     var imghtml='';
	          if(type == 0){//讨论
	          imghtml = '<img class="mui-media-object mui-pull-left" src="../../image/icon_taolun1.png" >'
	           }else{//调查
	            imghtml = '<img class="mui-media-object mui-pull-left" src="../../image/diaocha.png" >'
	           }
		       var htmls='<li class="mui-table-view-cell mui-media" id='+data.id+' onclick="openwin('+data.id+','+type+','+"'"+data.name+"'"+')">'+
				'<a href="javascript:;">'+
				     	imghtml+
					'<div class="mui-media-body">'+
						'<div class="right-div">'+
							'<div class="discuss-del-div">'+
								'<img class="discuss-del" src="../../icon/js_delete2.png" onclick="deletquestion('+data.id+')">'+
							'</div>'+
							'<p class="mui-ellipsis base_grey content_p right-tag font12">'+
	//						 status+
							'</p>'+
						'</div>'+
						'<div class="left-div">'+
							'<p class="mui-ellipsis base_black_grey font14 cell-title">'+
							'<span class="message_title ">'+
								data.name+
								'</span>  '+
							'</p>'+
							'<p class="mui-ellipsis base_grey font12 content_p cell-subtitle">'+
	//						data.classname+
							'</p>'+
							'<p class="mui-ellipsis base_grey font12 content_p cell-subtitle">'+
								'<span class="file_submit_time">'+
										timeWithStamp3(data.createtime)+
								'</span>'+
							'</p>'+
						'</div>'+
					'</div>'+
				'</a>'+
			 '</li>';

			 htmlsdata = htmlsdata +htmls;
		     }
		  	if (page == 1) {
				$('#questionsList').html(htmlsdata);
			} else {
				$('#questionsList').append(htmlsdata);
			}
		}
		function  deletquestion(id){
			event.stopPropagation();
		     $("#logout").show();
		    tid = id;
			
		}
		       //取消
		function cancel() {
			$("#logout").hide();
		}
		//确定
		function confirm() {
			delet();
			$("#logout").hide();
		}
       //删除
		function delet() {
		
			var params = {
				id : id,
				jid : $api.getStorage('cfnetppjxid'),
				uid : $api.getStorage('cfnetppuid'),
			}
//				alert(JSON.stringify(params));
			cfnetppPOST(url_Delactive, params, true, function(data, status) {
//				alert(JSON.stringify(data));
				api.hideProgress();
				if (status == 'success') {
					if (data.code == 200) {
						$('#' + tid).remove();
					}else{
				  ShowToast('删除失败')
				}
				}else{
				   ShowToast('删除失败')
				}
			})
		}
	
		</script>
</html>